package com.yiji.fintech.musfinance.common.enginerules.rules;

import com.yiji.fintech.musfinance.common.annotation.RuleNameAnnotation;
import com.yiji.fintech.musfinance.common.enginerules.base.RulesFilter;
import com.yiji.fintech.musfinance.common.domain.channel.ChannelDomain;
import org.springframework.stereotype.Service;

import java.util.stream.Collectors;

/**
 * Created by ouwen@yiji.com} on 2017/9/22.
 */
@Service
@RuleNameAnnotation("渠道费率规则服务")
public class RateRuleService extends RulesFilter{
    /**
     * 对渠道分类升序
     * @param domain
     */
    @Override
    protected void filter(ChannelDomain domain) {
        channelApiList = channelApiList.stream().sorted((s1,s2)-> (int) (s2.getRate().getCent() - s1.getRate().getCent()) ).collect(Collectors.toList());
    }
}
